package org.yourscrum.service;

import org.yourscrum.domain.Theme;
import org.yourscrum.domain.ThemeRepository;
import org.yourscrum.web.story.StoryVO;
import org.yourscrum.web.ThemeVO;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
 * @author Jettro Coenradie
 */
@Service("themeService")
public class ThemeServiceImpl implements ThemeService {
    private ThemeRepository themeRepository;

    @Autowired
    public ThemeServiceImpl(ThemeRepository themeRepository) {
        this.themeRepository = themeRepository;
    }

    public List<Theme> obtainThemes() {
        return themeRepository.obtainAllThemes();
    }

    public Theme addStoryToTheme(final StoryVO storyVO) {

        return null;
    }

    public Theme obtainThemeById(long themeId) {
        return themeRepository.obtainThemeById(themeId);
    }

    public Theme storeTheme(ThemeVO themeVO) {
        return themeRepository.createTheme(new Theme(themeVO.getName(), themeVO.getDescription()));
    }
}
